package com.topic.demo.mq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author :wn
 * @program : demo
 * @descript :
 * @create :2021-05-08 16:31
 */
@Component
public class TopicSender {
    @Autowired
    private AmqpTemplate amqpTemplate;
    public void send(){
        String context="topic ";
        System.out.println("Sender : "+context);
        amqpTemplate.convertAndSend("topicExchange","topic.1",context);
    }
    public void send2(){
        String context="topic2 ";
        System.out.println("Sender : "+context);
        amqpTemplate.convertAndSend("topicExchange","topic.a",context);
    }
    public void send3(){
        String context="topic3 ";
        System.out.println("Sender : "+context);
        amqpTemplate.convertAndSend("topicExchange","topic.b",context);
    }
}
